package com.niiwoo.civet.account.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 借款开户订单状态
 */
@AllArgsConstructor
@Getter
public enum OpenAccountOrderStatusEnum {

    PROCESSING((byte) 1, "处理中"),
    SUCCESS((byte) 2, "成功"),
    FAILURE((byte) 3, "失败");

    private final Byte value;
    private final String desc;

    public static OpenAccountOrderStatusEnum of(Byte value) {
        if (value != null) {
            for (OpenAccountOrderStatusEnum s : values()) {
                if (s.value.equals(value)) {
                    return s;
                }
            }
        }
        return null;
    }

    public static boolean except(Byte value, OpenAccountOrderStatusEnum... status) {
        return (status != null && status.length > 0) && Arrays.asList(status).contains(of(value));
    }


}
